function  [cd_0]=cd_0_lift_surf(geo_loc, flight_cond_loc, is_wing, flap,l_fus, S_wing)
% Function to compute zero lift drag for liftting surfaces (wing, htail, vtail, canard, etc.) for a given flight condition
% Examples:
% To WING Cd_0 at CRUISE call cd_0_wing_cruise=cd_0_lift_surf(geo.wing, flight_cond.cruise, 1, flap, geo.fus.lenght)
% To VTAIL Cd_0 at CLIMB call cd_0_vtail_climb=cd_0_lift_surf(geo.vtail, flight_cond.climb, 0, flap, geo.fus.lenght)

% l_fus = fuselage lenght

Rey_fus = flight_cond_loc.tas*flight_cond_loc.rho*l_fus/flight_cond_loc.mu; % Fuselage lenght Reynolds number
Rey = flight_cond_loc.tas*flight_cond_loc.rho*geo_loc.mgc/flight_cond_loc.mu; % Mean geometric chord Reynolds number

cd_0_flap = 0;% !!!!!!!!!!!!!!!!!!

if is_wing == 1
    % Wing-fuselage interference factor
    R_wt = calc_RWF(flight_cond_loc.Mach,Rey_fus); % See pg 151, fig 5.12, Roskan performance book
    if flap.ext ~= 0
        cd_0_flap = 0;
    else
        cd_0_flap = 0;
    end
else
    % Wing-fuselage interference factor
    R_wt = 1; % See pg 151, fig 5.12, Roskan performance book
end

% Lifting surface correction factor
R_LS = calc_RLS(flight_cond_loc.Mach,geo_loc.sweep_max_tc); % See pg 151, fig 5.12, Roskan performance book

% Airfoil tickness location parameter
t_loc_fact = 1.2; %See pg 153, fig 5.15, Roskan performance book

% Turbulent flat plate friction coeficient
C_f_surf = 0.455/(log10(Rey)^2.58*(1+0.144*flight_cond_loc.Mach^2)^0.58); %Turbulent mean skin friction coeficient

cd_0 = R_wt*R_LS*C_f_surf*(1+t_loc_fact*geo_loc.tc_mgc+100*(geo_loc.tc_mgc^4))*geo_loc.s_wet/S_wing+cd_0_flap; % function output


